<?php

namespace Modules\Admin\Models;
class OperationLog extends BaseModel
{
	/** 
     * @name  状态
     */
	public function status_lists(){
		return [
			'0'=>'没有权限',
			'1'=>'操作成功',	
		];
	}
	/** 
     * @name  关联管理员
     */
    public function admin_one()
    {
        return $this->hasOne('Modules\Admin\Models\Admin','id','admin_id');
    }
	/** 
     * @name  数据整理
     */
	public function data_list($data){
		$status_lists = $this->status_lists(); 
		foreach($data as $k=>$v){
			$data[$k]['status_name'] = $status_lists[$v['status']];
			$data[$k]['admin_name']  = $v['admin_one']['username'];
		}
		return $data;
	}
}
